package first.c02;

public class Movie {

	public static final int CHILDRENS = 2;
	public static final int REGULAR = 0;
	public static final int NEW_RELEASE = 1;
	public static final int COMPUTER=3;

	private String _title; // 名称
	private int _priceCode; // 价格（代号）

	private Price price;

	public Movie(String title, int priceCode) {
		_title = title;
		setPriceCode(_priceCode);
	}

	public int getPriceCode() {
		return _priceCode;
	}

	public void setPriceCode(int arg) {
		switch (arg) {
		case REGULAR:
			price = new Regular();
			break;
		case CHILDRENS:
			price = new Childrens();
			break;
		case NEW_RELEASE:
			price = new NewRelease();
			break;
		case COMPUTER:
			price=new Computer();
			break;
		default:
			throw new IllegalArgumentException("Incorrect Price Code");
		}
	}

	public String getTitle() {
		return _title;
	}

	public double getCharge(int daysRented) {
		return price.getCharge(daysRented);
	}

	public int getFrequentRenterPoints(int _daysRented) {
		return price.getFrequentRenterPoints(_daysRented);
	}

}
